package com.pansoft.openplanet.account.model;

import org.bitcoinj.wallet.Wallet;

import java.io.Serializable;
import java.util.List;

//btc钱包账户相关
public class BtcBean implements Serializable {

    /** 是否是hd钱包，这里hd指bip49钱包 **/
    private boolean isHdWallet;
    //地址
    private String btcAddress;

    //助记词
    private List<String> mnemonicList;
    //空格分割的助记词
    private String  mnemonic;
    //keystore 文件路径
    private String keyStoreFilePath;

    private String btcPrivKey;
    private String btcPubKey;

    //加密的助记词
    private String secretMnemonic;

    private Wallet wallet;

    /** btc hd bip49钱包 新增字段 **/
    //HD btc钱包的xpub
    private String hdBtcXpub;
    //表示HD btc钱包的选中子地址
    private String hdBtcCurrentChildAddress;
    //表示HD btc钱包的选中子地址的路径最大index，意思是
    //将要生成这么多个子地址，如"6"表示path"/0/1"....."/0/6"的地址都生成出来
    private String hdBtcMaxChildIndex;

    public BtcBean() {
    }

    private BtcBean(Builder builder) {
        setBtcAddress(builder.btcAddress);
        setMnemonicList(builder.mnemonicList);
        setMnemonic(builder.mnemonic);
        setKeyStoreFilePath(builder.keyStoreFilePath);
        setBtcPrivKey(builder.btcPrivKey);
        setBtcPubKey(builder.btcPubKey);
        setSecretMnemonic(builder.secretMnemonic);
        setWallet(builder.wallet);
    }

    public String getBtcAddress() {
        return btcAddress;
    }

    public BtcBean setBtcAddress(String btcAddress) {
        this.btcAddress = btcAddress;
        return this;
    }

    public List<String> getMnemonicList() {
        return mnemonicList;
    }

    public BtcBean setMnemonicList(List<String> mnemonicList) {
        this.mnemonicList = mnemonicList;
        return this;
    }

    public String getMnemonic() {
        return mnemonic;
    }

    public BtcBean setMnemonic(String mnemonic) {
        this.mnemonic = mnemonic;
        return this;
    }

    public String getKeyStoreFilePath() {
        return keyStoreFilePath;
    }

    public BtcBean setKeyStoreFilePath(String keyStoreFilePath) {
        this.keyStoreFilePath = keyStoreFilePath;
        return this;
    }

    public String getBtcPrivKey() {
        return btcPrivKey;
    }

    public BtcBean setBtcPrivKey(String btcPrivKey) {
        this.btcPrivKey = btcPrivKey;
        return this;
    }

    public String getBtcPubKey() {
        return btcPubKey;
    }

    public BtcBean setBtcPubKey(String btcPubKey) {
        this.btcPubKey = btcPubKey;
        return this;
    }

    public String getSecretMnemonic() {
        return secretMnemonic;
    }

    public BtcBean setSecretMnemonic(String secretMnemonic) {
        this.secretMnemonic = secretMnemonic;
        return this;
    }

    public Wallet getWallet() {
        return wallet;
    }

    public BtcBean setWallet(Wallet wallet) {
        this.wallet = wallet;
        return this;
    }

    public boolean isHdWallet() {
        return isHdWallet;
    }

    public void setHdWallet(boolean hdWallet) {
        isHdWallet = hdWallet;
    }

    public String getHdBtcXpub() {
        return hdBtcXpub;
    }

    public void setHdBtcXpub(String hdBtcXpub) {
        this.hdBtcXpub = hdBtcXpub;
    }

    public String getHdBtcCurrentChildAddress() {
        return hdBtcCurrentChildAddress;
    }

    public void setHdBtcCurrentChildAddress(String hdBtcCurrentChildAddress) {
        this.hdBtcCurrentChildAddress = hdBtcCurrentChildAddress;
    }

    public String getHdBtcMaxChildIndex() {
        return hdBtcMaxChildIndex;
    }

    public void setHdBtcMaxChildIndex(String hdBtcMaxChildIndex) {
        this.hdBtcMaxChildIndex = hdBtcMaxChildIndex;
    }

    public static final class Builder {
        private String btcAddress;
        private List<String> mnemonicList;
        private String mnemonic;
        private String keyStoreFilePath;
        private String btcPrivKey;
        private String btcPubKey;
        private String secretMnemonic;
        private Wallet wallet;

        public Builder() {
        }

        public Builder btcAddress(String val) {
            btcAddress = val;
            return this;
        }

        public Builder mnemonicList(List<String> val) {
            mnemonicList = val;
            return this;
        }

        public Builder mnemonic(String val) {
            mnemonic = val;
            return this;
        }

        public Builder keyStoreFilePath(String val) {
            keyStoreFilePath = val;
            return this;
        }

        public Builder btcPrivKey(String val) {
            btcPrivKey = val;
            return this;
        }

        public Builder btcPubKey(String val) {
            btcPubKey = val;
            return this;
        }

        public Builder secretMnemonic(String val) {
            secretMnemonic = val;
            return this;
        }

        public Builder wallet(Wallet val) {
            wallet = val;
            return this;
        }

        public BtcBean build() {
            return new BtcBean(this);
        }
    }
}
